home *** CD-ROM | disk | FTP | other *** search
/ Amiga Developer CD 2.1 / Amiga Developer CD v2.1.iso / Reference / DevCon / Atlanta_1990 / Atlanta-Devcon.2 / Libraries / IFFParse / Include / iffparse.i < prev   
Encoding:
Text File  |  1992-08-26  |  5.6 KB  |  197 lines

  1. *\ :ts=8 bk=0
  2. *
  3. * iffparse.i:    Assembly include file for iffparse.library.
  4. *        Generated by hand from iffparse.h (9006.04)
  5. *
  6. * Leo L. Schwab                        9006.04
  7. */
  8.         IFND    IFF_IFFPARSE_I
  9. IFF_IFFPARSE_I    SET    1
  10.  
  11.         IFND    EXEC_TYPES_I
  12.         include 'exec/types.i'
  13.         ENDC
  14.  
  15.         IFND    EXEC_LISTS_I
  16.         include 'exec/lists.i'
  17.         ENDC
  18.  
  19.         IFND    EXEC_PORTS_I
  20.         include 'exec/ports.i'
  21.         ENDC
  22.  
  23.         IFND    DEVICES_CLIPBOARD_I
  24.         include 'devices/clipboard.i'
  25.         ENDC
  26.  
  27. *\
  28. * Struct associated with an active IFF stream.
  29. * "iff_Stream" is a value used by the client's read/write/seek functions -
  30. * it will not be accessed by the library itself and can have any value
  31. * (could even be a pointer or a BPTR).
  32. */
  33.     STRUCTURE IFFHandle,0
  34.         ULONG    iff_Stream
  35.         ULONG    iff_Flags
  36.         LONG    iff_Depth    ; Depth of context stack.
  37. * There are private fields hiding here.
  38.     LABEL    iff_SIZEOF
  39.  
  40. *\
  41. * Bit masks for "iff_Flags" field.
  42. */
  43. IFFF_READ    EQU    0            ; read mode - default
  44. IFFF_WRITE    EQU    1            ; write mode
  45. IFFF_RWBITS    EQU    IFFF_READ!IFFF_WRITE    ; read/write bits
  46. IFFF_FSEEK    EQU    1<<1            ; forward seek only
  47. IFFF_RSEEK    EQU    1<<2            ; random seek
  48. IFFF_RESERVED    EQU    $FFFF0000        ; Don't touch these bits.
  49.  
  50. *\
  51. * When the library calls your stream handler, you'll be passed a pointer
  52. * to this structure as the "message packet".
  53. */
  54.     STRUCTURE IFFStreamCmd,0
  55.         LONG    sc_Command    ; Operation to be performed (IFFCMD_)
  56.         APTR    sc_Buf        ; Pointer to data buffer
  57.         LONG    sc_NBytes    ; Number of bytes to be affected
  58.     LABEL    sc_SIZEOF
  59.  
  60. *\
  61. * A node associated with a context on the iff_Stack.  Each node
  62. * represents a chunk, the stack representing the current nesting 
  63. * of chunks in the open IFF file.  Each context node has associated
  64. * local context items in the (private) LocalItems list.  The ID, type,
  65. * size and scan values describe the chunk associated with this node.
  66. */
  67.     STRUCTURE ContextNode,MLN_SIZE    ; cn_Node
  68.         LONG    cn_ID
  69.         LONG    cn_Type
  70.         LONG    cn_Size        ; Size of this chunk
  71.         LONG    cn_Scan        ; # of bytes read/written so far
  72. * There are private fields hiding here.
  73.     LABEL    cn_SIZEOF
  74.  
  75. *\
  76. * Local context items live in the ContextNode's.  Each class is identified
  77. * by its lci_Ident code and has a (private) purge vector for when the
  78. * parent context node is popped.
  79. */
  80.     STRUCTURE LocalContextItem,MLN_SIZE    ; lci_Node
  81.         ULONG    lci_ID
  82.         ULONG    lci_Type
  83.         ULONG    lci_Ident
  84. * There are private fields hiding here.
  85.     LABEL    lci_SIZEOF
  86.  
  87. *\
  88. * StoredProperty: a local context item containing the data stored
  89. * from a previously encountered property chunk.
  90. */
  91.     STRUCTURE StoredProperty,0
  92.         LONG    sp_Size
  93.         APTR    sp_Data
  94.     LABEL    sp_SIZEOF
  95.  
  96. *\
  97. * Collection Item: the actual node in the collection list at which
  98. * client will look.  The next pointers cross context boundaries so
  99. * that the complete list is accessable.
  100. */
  101.     STRUCTURE CollectionItem,0
  102.         APTR    ci_Next
  103.         LONG    ci_Size
  104.         APTR    ci_Data
  105.     LABEL    ci_SIZEOF
  106.  
  107. *\
  108. * Structure returned by OpenClipboard().  You may do CMD_POSTs and such
  109. * using this structure.  However, once you call OpenIFF(), you may not
  110. * do any more of your own I/O to the clipboard until you call CloseIFF().
  111. */
  112.     STRUCTURE ClipboardHandle,iocr_SIZEOF    ; cbh_Reg
  113.         STRUCT    cbh_CBport,MP_SIZE
  114.         STRUCT    cbh_SatisfyPort,MP_SIZE
  115.     LABEL    cbh_SIZEOF
  116.  
  117. *\
  118. * IFF return codes.  Most functions return either zero for success or
  119. * one of these codes.  The exceptions are the read/write functions which
  120. * return positive values for number of bytes or records read or written,
  121. * or a negative error code.  Some of these codes are not errors per sae,
  122. * but valid conditions such as EOF or EOC (End of Chunk).
  123. */
  124. IFFERR_EOF        EQU    -1    ; Reached logical end of file
  125. IFFERR_EOC        EQU    -2    ; About to leave context
  126. IFFERR_NOSCOPE        EQU    -3    ; No valid scope for property
  127. IFFERR_NOMEM        EQU    -4    ; Internal memory alloc failed
  128. IFFERR_READ        EQU    -5    ; Stream read error
  129. IFFERR_WRITE        EQU    -6    ; Stream write error
  130. IFFERR_SEEK        EQU    -7    ; Stream seek error
  131. IFFERR_MANGLED        EQU    -8    ; Data in file is corrupt
  132. IFFERR_SYNTAX        EQU    -9    ; IFF syntax error
  133. IFFERR_NOTIFF        EQU    -10    ; Not an IFF file
  134. IFFERR_NOHOOK        EQU    -11    ; No call-back hook provided
  135. IFF_RETURN2CLIENT    EQU    -12    ; Client handler normal return
  136.  
  137. *\
  138. * Universal IFF identifiers.
  139. */
  140. ID_FORM            EQU    'FORM'
  141. ID_LIST            EQU    'LIST'
  142. ID_CAT            EQU    'CAT '
  143. ID_PROP            EQU    'PROP'
  144. ID_NULL            EQU    '    '
  145.  
  146. *\
  147. * Ident codes for universally recognized local context items.
  148. */
  149. IFFLCI_PROP        EQU    'prop'
  150. IFFLCI_COLLECTION    EQU    'coll'
  151. IFFLCI_ENTRYHANDLER    EQU    'enhd'
  152. IFFLCI_EXITHANDLER    EQU    'exhd'
  153.  
  154. *\
  155. * Control modes for ParseIFF() function.
  156. */
  157. IFFPARSE_SCAN        EQU    0
  158. IFFPARSE_STEP        EQU    1
  159. IFFPARSE_RAWSTEP    EQU    2
  160.  
  161. *\
  162. * Control modes for StoreLocalItem().
  163. */
  164. IFFSLI_ROOT        EQU    1    ; Store in default context
  165. IFFSLI_TOP        EQU    2    ; Store in current context
  166. IFFSLI_PROP        EQU    3    ; Store in topmost FORM or LIST
  167.  
  168. *\
  169. * "Flag" for writing functions.  If you pass this value in as a size
  170. * to PushChunk() when writing a file, the parser will figure out the
  171. * size of the chunk for you.  (Chunk sizes >= 2**31 are forbidden by the
  172. * IFF specification, so this works.)
  173. */
  174. IFFSIZE_UNKNOWN        EQU    -1
  175.  
  176. *\
  177. * Possible call-back command values.  (Gee, it would be nice if there was an
  178. * ENUM macro.)
  179. */
  180. IFFCMD_INIT        EQU    0    ; Prepare your stream for a session
  181. IFFCMD_CLEANUP        EQU    1    ; Terminate stream session
  182. IFFCMD_READ        EQU    2    ; Read bytes from stream
  183. IFFCMD_WRITE        EQU    3    ; Write bytes to stream
  184. IFFCMD_SEEK        EQU    4    ; Seek on stream
  185. IFFCMD_ENTRY        EQU    5    ; You just entered a new context
  186. IFFCMD_EXIT        EQU    6    ; You're about to leave a context
  187. IFFCMD_PURGELCI        EQU    7    ; Purge a LocalContextItem
  188.  
  189. * Backward compatibility.  Don't use these in new code.
  190. IFFSCC_INIT        EQU    IFFCMD_INIT
  191. IFFSCC_CLEANUP        EQU    IFFCMD_CLEANUP
  192. IFFSCC_READ        EQU    IFFCMD_READ
  193. IFFSCC_WRITE        EQU    IFFCMD_WRITE
  194. IFFSCC_SEEK        EQU    IFFCMD_SEEK
  195.  
  196.         ENDC    ; IFF_IFFPARSE_I
  197.